Lesson 0006 · ~15 min
Self-attention: queries, keys, values
Core idea: Each token produces a query, keys decide matches, values carry content, and masking limits which tokens can be attended to.
What to remember
- Query: what this token is looking for.
- Key: how a token can be matched.
- Value: what information it contributes.
- Mask: which tokens are allowed into the attention calculation.
Why it matters
This is the internal shape of attention, not just the surface intuition.
Mental model
- Take one token’s query
- Compare to allowed keys
- Get relevance weights
- Mix the corresponding values
Checkpoint
- What job does the mask do?
- Why split keys from values?
- Why can’t a causal model attend to future tokens?